Skip to content

fix(retain): clarify fact type boundary for user rules#2440

Merged
nicoloboschi merged 2 commits into
vectorize-io:mainfrom
koriyoshi2041:rios/clarify-retain-fact-type-boundary
Jun 30, 2026
Merged

fix(retain): clarify fact type boundary for user rules#2440
nicoloboschi merged 2 commits into
vectorize-io:mainfrom
koriyoshi2041:rios/clarify-retain-fact-type-boundary

Conversation

@koriyoshi2041

Copy link
Copy Markdown
Contributor

Problem

User preferences, rules, corrections, and constraints can be stated during assistant interactions, but they are durable facts about the user rather than assistant experiences. The current fact extraction guidance made that boundary easy to blur, which can send durable user facts through the experience path.

Fixes #2437.

Fix

  • Clarify the retain fact_type prompt so user preferences/rules/corrections/constraints remain world even when mentioned in an assistant interaction.
  • Narrow assistant to actions or experiences the assistant/agent actually performed.
  • Align the Pydantic schema field descriptions and verbatim/verbose prompt guidance with the same boundary.
  • Add a prompt/schema regression test that locks this wording down without calling a live LLM.

Test

  • uv run pytest tests/test_fact_extraction_fact_type_prompt.py -q
  • uv run ruff check hindsight_api/engine/retain/fact_extraction.py tests/test_fact_extraction_fact_type_prompt.py
  • uv run ruff format --check hindsight_api/engine/retain/fact_extraction.py tests/test_fact_extraction_fact_type_prompt.py
  • git diff --check

Risk

Low-to-medium. This is prompt/schema guidance only, not persistence or mapping logic. It should reduce misclassification of user facts, but prompt wording can affect extraction behavior, so the change is intentionally narrow.

@nicoloboschi nicoloboschi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nicoloboschi nicoloboschi merged commit 7b878f8 into vectorize-io:main Jun 30, 2026
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fact_type misclassified — user preferences/rules/corrections stored as "experience" instead of "world"

2 participants